import Vue from 'vue'
import Component from 'vue-class-component'
import './searchStyle.css'

@Component
export default class SearchClass extends Vue {
  searchValue = ''
  myPlaceholder = ''

  created() {
    var string = this.$route.params.type
    console.log('string')
    if (string && string === '商品') {
      this.myPlaceholder = '搜索商品'
    } else if (string && string === '专题') {
      this.myPlaceholder = '搜索专题'
    } else if (string && string === '图片') {
      this.myPlaceholder = '搜索图片'
    } else {
      this.myPlaceholder = '搜索订单'
    }
  }

  render () {
    return (
      <div class='content' style='position:relative'>
      <div class="searchHeaderClass">
        <span onClick={() => { this.$router.go(-1) }} ><icon name = 'backIcon' scale='2'/></span>
        <mt-search
          v-model={this.searchValue}
          cancel-text="取消"
          placeholder={this.myPlaceholder}>
        </mt-search>
      </div>
      </div>
    )
  }
}
